﻿using Mozhi.Abp.Domain.BasicData;
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace mozhi.smarterp.Business.Inventories
{
    /// <summary>
    /// 库存余额表
    /// </summary>
    public class InventoryBalance : AuditedAggregateRoot<Guid>, IMultiTenant
    {
        public Guid? TenantId { get; private set; }

        public Guid ProductId { get; private set; }

        public Product Product { get; private set; }

        public Guid WarehouseId { get; private set; }

        public Warehouse Warehouse { get; private set; }

        public Guid? LocationId { get; private set; }

        /// <summary>
        /// 计价方式为先进先出时，为必填
        /// </summary>
        public DateTime? InboundDate { get; private set; }

        public string BatchNumber { get; private set; }

        public string SerialNumber { get; private set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime? ProductionDate { get; private set; }

        /// <summary>
        /// 保质期（天）
        /// </summary>
        public decimal? ShelfLifeDays { get; private set; }

        /// <summary>
        /// 过期日期
        /// </summary>
        public DateTime? ExpirationDate { get; private set; }

        /// <summary>
        /// 库存单位
        /// </summary>
        public Guid BasicUnitId { get; private set; }

        /// <summary>
        /// 期初数量
        /// </summary>
        public decimal OpeningQuantity { get; private set; }

        public decimal OpeningAmount {  get; private set; }

        /// <summary>
        /// 本期入库数量
        /// </summary>
        public decimal PeriodInboundQuantity {  get; private set; }

        /// <summary>
        /// 本期入库金额
        /// </summary>
        public decimal PeriodInboundAmount { get; private set; }

        /// <summary>
        /// 本期出库数量
        /// </summary>
        public decimal PeriodOutboundQuantity {  get; private set; }

        /// <summary>
        /// 本期出库金额
        /// </summary>
        public decimal PeriodOutboundAmount { get; private set; }

        /// <summary>
        /// 期末数量
        /// </summary>
        public decimal ClosingQuantity {  get; private set; }

        /// <summary>
        /// 期末金额
        /// </summary>
        public decimal ClosingAmount { get; private set; }

        public int Period {  get; private set; }

        private InventoryBalance() { }
    }
}
